// RecordQueryHandler.h: interface for the RecordQueryHandler class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_RECORDQUERYHANDLER_H__FE8572CE_8363_4BEE_9235_3B4E6F2B1E46__INCLUDED_)
#define AFX_RECORDQUERYHANDLER_H__FE8572CE_8363_4BEE_9235_3B4E6F2B1E46__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "BaseRequestHandler.h"

struct RecordQueryStruct;
struct RecordQueryStructEx;
struct RecordAckStruct;
struct RecordAckStructEx;
struct Record;
class RecordManager;

class RecordQueryHandler : public BaseRequestHandler
{
public:
	RecordQueryHandler(const Packet& packet, HANDLE hClient, bool bIsRequestEx);
	RecordQueryHandler(const Packet& packet, HANDLE hClient);
	virtual ~RecordQueryHandler();

	virtual bool Prehandling();
	virtual bool PrehandlingEx();
	virtual bool IsFurtherHandlingNeeded() {return true;}

protected:
	virtual int Handling();
	virtual int HandlingEx();

protected:
	RecordAckStruct * m_pRecordAckStruct;

	RecordAckStructEx * m_pRecordAckStructEx;

	int CheckQueryParam(RecordQueryStruct * pRecordQueryStruct);

	RecordAckStruct * QueryRecords();
	RecordAckStructEx * QueryRecordsEx();

	int DoQueryRecords(long nCoalMineId, const CString& strMonUnitId, const CTime& timeBegin, const CTime& timeEnd, RecordManager * pRecordManager, Record * pDefaultRecord);

	DWORD FileSeek(CFile * pFile, LONGLONG lOff, UINT nFrom);
};

#endif // !defined(AFX_RECORDQUERYHANDLER_H__FE8572CE_8363_4BEE_9235_3B4E6F2B1E46__INCLUDED_)
